import QtQuick 2.15
import QtQuick.Controls 2.15
import IconItemModule 1.0

MouseArea {
    id: control

    property string appStatus: ""
    property string appAttentionMovieName: ""
    property var appIcon
    property var appAttentionIcon
    property var appOverlayIcon: ""
    property int iconRotation: 0

    Item {
        id: trayitem
        anchors.fill: parent
        rotation: control.iconRotation

        Loader {
            anchors.centerIn: parent
            sourceComponent: ((control.appStatus === "NeedsAttention") && (control.appAttentionMovieName !== "")) ? movieComponent : iconComponent
        }

        Component {
            id: iconComponent
            IconItem {
                width: 16
                height: 16
                icon: (control.appStatus === "NeedsAttention") ? control.appAttentionIcon : control.appIcon
                overlayIcon: appOverlayIcon
                isInverseColor: false
            }
        }

        Component {
            id: movieComponent
            AnimatedImage {
                width: 16
                height: 16
                source: control.appAttentionMovieName
            }
        }
    }
}
